<script setup>
import Children from "./Children.vue";
import {ref, getCurrentInstance} from "vue";

const childRef = ref(null);
const {proxy} = getCurrentInstance();

function click1() {
  childRef.value.say()
}

function click2() {
  proxy.$refs.childRef.open()
}
</script>

<template>
  <el-container>
    <el-main>
      <el-form inline>
        <el-form-item>
          <el-button type="primary" @click="click1">父调子方式一</el-button>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="click2">父调子方式二</el-button>
        </el-form-item>
      </el-form>
      <!--子组件-->
      <children ref="childRef"/>
    </el-main>
  </el-container>
</template>

<style scoped>

</style>